package quoridorDecisionMaker;

import java.util.ArrayList;
import java.util.Random;

import quoridor.Action;
import quoridor.Board;
import quoridor.Move;
import quoridor.QuoridorAction;

public class RandomDecisionMaker extends AbstractDecisionMaker {
	private static Random rnd;
	
	
	public RandomDecisionMaker(Board board) {
		super(board);
		//use the current time to seed the random number generator
		rnd = new Random();
	}

	@Override
	public Action getAction() {
		ArrayList <Move> list = null;
		int numMoves;
		MoveSearch moveSearch = new MoveSearch(board);

		list = moveSearch.getMoves();
		assert(list != null);
		numMoves = list.size();
		
		return new QuoridorAction(list.get(rnd.nextInt(numMoves)));
	}

}
